﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StockholmsStad.Web.UI.Class.Utilities;
using StockholmsStad.Web.UI.UIServiceReference;

namespace StockholmsStad.Web.UI.Test
{
    /// <summary>
    ///This is a test class for SessionItemTest and is intended
    ///to contain all SessionItemTest Unit Tests
    ///</summary>
    [TestClass()]
    public class SessionItemTest
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #region Additional test attributes

        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //

        #endregion

        /// <summary>
        ///A test for TicketId
        ///</summary>
        [TestMethod()]
        public void UserTest()
        {
            var target = new SessionItem();
            User expected = new User()
                                {
                                    CoupleId = 42,
                                };
            User actual;
            target.User = expected;
            actual = target.User;
            Assert.AreEqual(expected.CoupleId, actual.CoupleId);
        }

        /// <summary>
        ///A test for TicketId
        ///</summary>
        [TestMethod()]
        public void TicketIdTest2()
        {
            var target = new SessionItem();
            User expected = null;
            User actual;
            target.User = expected;
            actual = target.User;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Couple
        ///</summary>
        [TestMethod()]
        public void CoupleTest()
        {
            var target = new SessionItem();
            var expected = new Couple();
            Couple actual;
            target.Couple = expected;
            actual = target.Couple;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Ceremony
        ///</summary>
        [TestMethod()]
        public void CeremonyTest()
        {
            var target = new SessionItem();
            var expected = new Ceremony();
            Ceremony actual;
            target.Ceremony = expected;
            actual = target.Ceremony;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CachedFreeTimeblocks
        ///</summary>
        [TestMethod()]
        public void CachedFreeTimeblocksTest()
        {
            var target = new SessionItem();
            IOrderedEnumerable<DateTime> expected = CreateList();
            IOrderedEnumerable<DateTime> actual;
            target.CachedFreeTimeblocks = expected;
            actual = target.CachedFreeTimeblocks;
            Assert.AreEqual(expected, actual);
        }

        private IOrderedEnumerable<DateTime> CreateList()
        {
            return new List<DateTime>()
                       {
                           new DateTime(),
                           new DateTime(2008, 01, 01),
                           DateTime.Now,
                       }.OrderBy(d => d.Ticks);
        }

        /// <summary>
        ///A test for CachedBookedTimeblocks
        ///</summary>
        [TestMethod()]
        public void CachedBookedTimeblocksTest()
        {
            var target = new SessionItem();
            IOrderedEnumerable<DateTime> expected = CreateList();
            IOrderedEnumerable<DateTime> actual;
            target.CachedBookedTimeblocks = expected;
            actual = target.CachedBookedTimeblocks;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Booking
        ///</summary>
        [TestMethod()]
        public void BookingTest()
        {
            var target = new SessionItem();
            var expected = new Booking();
            Booking actual;
            target.Booking = expected;
            actual = target.Booking;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for SessionItem Constructor
        ///</summary>
        [TestMethod()]
        public void SessionItemConstructorTest()
        {
            var target = new SessionItem();
            Assert.IsNotNull(target);
        }
    }
}